home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 11 / CU Amiga Magazine's Super CD-ROM 11 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-06].iso / s / addtolabeldatabase.pprx next >
Text File  |  1992-08-01  |  3KB  |  107 lines

  1. /*
  2. @B AddToLabelDataBase @P@ICopyright Gold Disk Inc., July, 1992
  3.     This Genie allows you to add an entry to an existing label database.
  4. Please refer to clip or pic supplied for more information.
  5. */
  6.  
  7. call SafeEndEdit.rexx()
  8. units = ppm_GetUnits()
  9. cr = '0a'x
  10.  
  11. pgdir = readini.rexx("PG")
  12.  
  13. do forever
  14.  
  15.     labeltype = ppm_Inform(3,"Would you  like to add a Dot Matrix label or a Laser Label?", "Cancel", "Dot Matrix", "Laser")
  16.  
  17.     if labeltype = 0 then exit_msg()
  18.  
  19.     if labeltype = 1 then
  20.     do
  21.  
  22.         form = "Part Number"cr"Label Type"cr"Label Height"cr"Label Width"cr"Num. Columns"cr"Carrier Width"cr"Horizontal Pitch"cr"Vertical Pitch"
  23.  
  24.         form = ppm_GetForm("Enter Label Specifications..", 20, form)
  25.         if form = '' then exit_msg()
  26.  
  27.         parse var form pnum '0a'x type '0a'x lheight '0a'x lwid '0a'x cols '0a'x cwidth '0a'x hpitch '0a'x vpitch
  28.  
  29.         if ~(datatype(lheight, n) & datatype(lwid, n) & datatype(cols, n) & datatype(cwidth,n) & datatype(hpitch, n) & datatype(vpitch, n)) then exit_msg("Invalid entry")
  30.  
  31.         if units ~= 1 then
  32.         do
  33.             lheight    = ppm_ConvertUnits(units, 1, lheight)
  34.             lwid    = ppm_ConvertUnits(units, 1, lwid)
  35.             cwidth    = ppm_ConvertUnits(units, 1, cwidth)
  36.             hpitch    = ppm_ConvertUnits(units, 1, hpitch)
  37.             vpitch    = ppm_ConvertUnits(units, 1, vpitch)
  38.         end
  39.  
  40.         line = pnum';'type';'lheight';'lwid';'cols';'cwidth';'hpitch';'vpitch
  41.  
  42.         filename = ppm_GetFileName("Select label database..", pgdir, "")
  43.         if filename = '' then exit_msg()
  44.  
  45.         if ~open(file, filename, r) then exit_msg("Unable to open file: "filename)
  46.         fline = readln(file)
  47.         if pos('MATRIX', fline) = 0 then exit_msg("This is not a Dot Matrix Label Database..")
  48.  
  49.         call seek(file, 0, e)
  50.         call writeln(file, line)
  51.         call close(file)
  52.         call ppm_Inform(1,"Finished..",)
  53.     end
  54.     else
  55.     do
  56.  
  57.         form = "Part Number"cr"Label Type"cr"Label Height"cr"Label Width"cr"Num. Columns"cr"Num. Rows"cr"Top Margin"cr"Side Margin"cr"Horizontal Pitch"cr"Vertical Pitch"
  58.  
  59.         form = ppm_GetForm("Enter Label Specifications..", 20, form)
  60.         if form = '' then exit_msg()
  61.  
  62.         parse var form pnum '0a'x type '0a'x lheight '0a'x lwid '0a'x cols '0a'x rows '0a'x tmarg '0a'x smarg '0a'x hpitch '0a'x vpitch
  63.  
  64.         if ~(datatype(lheight, n) & datatype(lwid, n) & datatype(cols, n) & datatype(rows,n) & datatype(tmarg, n) & datatype(smarg, n) & datatype(hpitch, n) & datatype(vpitch, n)) then exit_msg("Invalid entry")
  65.  
  66.         if units ~= 1 then
  67.         do
  68.             lheight    = ppm_ConvertUnits(units, 1, lheight)
  69.             lwid    = ppm_ConvertUnits(units, 1, lwid)
  70.             tmarg    = ppm_ConvertUnits(units, 1, tmarg)
  71.             smarg    = ppm_ConvertUnits(units, 1, smarg)
  72.             hpitch    = ppm_ConvertUnits(units, 1, hpitch)
  73.             vpitch    = ppm_ConvertUnits(units, 1, vpitch)
  74.         end
  75.  
  76.         line = pnum';'type';'lheight';'lwid';'cols';'rows';'tmarg';'smarg';'hpitch';'vpitch
  77.  
  78.         filename = ppm_GetFileName("Select label database..", pgdir, "")
  79.         if filename = '' then exit_msg()
  80.         
  81.         if ~open(file, filename, r) then exit_msg("Unable to open file: "filename)
  82.         fline = readln(file)
  83.         if pos('LASER', fline) = 0 then exit_msg("This is not a Laser Label Database..")
  84.         call seek(file, 0, e)
  85.         call writeln(file, line)
  86.         call close(file)
  87.  
  88.         call ppm_Inform(1,"Finished..",)
  89.     end
  90. end
  91.  
  92. exit_msg()
  93.  
  94. exit_msg: procedure expose units
  95. do
  96.     parse arg message
  97.  
  98.     if message ~= '' then call ppm_Inform(1,message,)
  99.     call ppm_SetUnits(units)
  100.     exit
  101. end
  102.  
  103.  
  104.  
  105.  
  106.